<template>
	<view v-if="show" class="mask flex-c full-screen">
		<view class="dialog">
			<view class="title">好友请求</view>
			<view class="FriendDetail">
				<view class="author-image border-round">
					<lazy-image class="inheritwh border-round"
						:src="FriendDetail.expertAvatar+'?imageView2/1/w/100/h/100/q/50'" type="expert"
						fit="cover"></lazy-image>
				</view>
				<view class="author-info flex-c">
					<view class="info-top flex-r">
						<view class="flex-r">
							<text class="text-secondary text-bold">{{FriendDetail.expertName}}</text>
							<text class="tag-red" v-if="FriendDetail.hotContineTxt">{{FriendDetail.hotContineTxt}}</text>
							<text class="tag-gold" v-else-if="FriendDetail.hitResultTxt">{{article.hitResultTxt}}</text>
						</view>
						<text class="fansNum">{{FriendDetail.fansNum}}粉丝</text>
					</view>
				</view>
			</view>
			<view class="content">
				{{FriendDetail.content}}
			</view>
			<view class="button" v-if="FriendDetail.status!=0">
				<view class="close"  @tap="close">关闭</view>
			</view>
			<view v-else class="button">
				<view  class="button-content cancellation" @tap="cancellation">取消</view>
				<view  class="button-content determine" @tap="determine">同意关注</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'ch-poput',
		props: {
			show: {
				type: Boolean,
				default: false,
			},
			FriendDetail: {
				type: Object,
				default: null
			},
			resources:{
				type:String,
				default:null
			}
		},
		data() {
			return {
				status:null,//好友申请状态
			}
		},
		created() {
			console.log(this.$props)
		},
		methods: {
			//显示隐藏
			changeShow(value) {
				this.$emit("getShow", value)
			},
			//确定好友申请
			determine(){
				this.getFriendStatul(1)
				this.changeShow(false)
			},
			//不同意好友申请
			cancellation(){
				this.getFriendStatul(2)
				this.changeShow(false)
			},
			//关闭好友申请
			close(){
				this.changeShow(false)
			},
			//确定好友申请
			getFriendStatul(status){
				this.$http.post({
					url:"/api/im/edit",
					data:{
						id:Number(this.resources),
						status:status
					}
				}).then((data)=>{
					console.log(data)
				}).catch((err)=>{
					console.log(err)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.mask {
		position: fixed;
		top: 0;
		left: 0;
		width: 100vw;
		height: 100vh;
		background-color: rgba(0, 0, 0, 0.4);
		z-index: 999;
		width: 100%;
		margin: $pc-margin;
		overflow-y: auto;
		.dialog {
			width: 640rpx;
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
			z-index: 1000;
			background-color: #fff;
			border-radius: 10rpx;
			.title {
				text-align: center;
				font-size: 36rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #303233;
				line-height: 96rpx;
				box-shadow: 0rpx 1rpx 0rpx 0rpx #E8EBED;
			}

			.FriendDetail {
				padding: 0 30rpx;
				margin: 20rpx;
				margin-left: 0;
				display: flex;
				.author-image {
					position: relative;
					width: 80rpx;
					height: 80rpx;
					background-color: #FFFFFF;
				}

				.author-info {
					// flex: 2;
					margin-left: 20rpx;
					.info-top {
						display: flex;
						flex-direction: column;
						justify-content: center;
						.icon {
							margin-left: 8rpx;
							width: 24rpx;
							height: 24rpx;
						}
						.fansNum{
							font-size: 24rpx;
							font-family: PingFang SC;
							font-weight: 400;
							color: #999999;
							line-height: 36rpx;
						}
					}
					.text-info {
						margin-top: 15rpx;
					}
					.text-artivle {
						width: 420rpx;
						overflow: hidden;
						white-space: nowrap;
						text-overflow: ellipsis;
					}
				}
			}
			.content{
				margin: 20rpx;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 400;
				color: #999999;
				line-height: 42rpx;
			}
			.button{
				display: flex;
				height: 96rpx;
				background: #FFFFFF;
				font-size: 32rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #303233;
				text-align: center;
				line-height: 96rpx;
				cursor: pointer;
				.button-content{
					width: 320rpx;
				}
				.cancellation{
					border-bottom-left-radius: 10rpx;
					box-shadow: 0rpx -1rpx 0rpx 0rpx #E8EBED;
				}
				.determine{
					color: #0055FF;
					border-bottom-right-radius: 10rpx;
					border-left: 1rpx solid #E8EBED;
					box-shadow: 0rpx -1rpx 0rpx 0rpx #E8EBED;
				}
				.close{
					width: 640rpx;					
					border-bottom-left-radius: 10rpx;
					border-bottom-right-radius: 10rpx;
					box-shadow: 0rpx -1rpx 0rpx 0rpx #E8EBED;
				}
			}
		}
	}
</style>